package org.foreveross.que.infra.impl;

import java.util.Arrays;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.foreveross.que.entity.RoleMenuREntity;
import org.foreveross.que.infra.RoleMenuRRepository;
import org.foreveross.que.infra.base.ddd.repository.EntityHibernateRepository;
import org.springframework.stereotype.Repository;
@Repository
public class RoleMenuRRepositoryImpl  extends EntityHibernateRepository implements RoleMenuRRepository  {
	
	public List <RoleMenuREntity> findByRole(Object[] roles,String sysType){
		if(roles==null||roles.length==0){
			return null;
		}
		String roleStr = Arrays.toString(roles);
		roleStr = StringUtils.substring(roleStr, 1,roleStr.length()-1);
		return this.queryResult("from RoleMenuREntity t where t.rid in ("+roleStr+") and t.sysType='"+sysType+"'");
		
	}
	
}
